<?php

/**
 * User: @lixu
 * Date: 2019-05-28
 * Time: 11:10
 */

use Biz\service\wiki\ClassifyList as sClassifyList;

class ClassifyListAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_NOTHING;
    const IS_LOG_EXPOSE = 1;

    public function main()
    {
        $categoryId = $this->getRequest()->getQuery('category_id', 0);
        $params = $this->getRequest()->getQuery('params', []);
        $sortType = $this->getRequest()->getQuery('sort_type', 0);
        $page = $this->getRequest()->getQuery('page', 1);
        $page = $page < 1 ? 1 : abs($page);

        $currentTime = \Biz\service\wiki\Schedule::getCurrentTime($page, $this->uid, $categoryId);
        $list = sClassifyList::getList($categoryId, $params, $sortType, $page, $this->uid, $currentTime);
        $this->setSuccess($list);
    }
}